from database.database import db

class User(db.Model):
    __tablename__ = 'user'
    
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.String(255), nullable=False)
    user_name = db.Column(db.String(255), nullable=False)
    user_password = db.Column(db.String(255), nullable=False)
    user_jurisdiction = db.Column(db.Integer, nullable=False)
    
    def __init__(self, user_id, user_name, user_password, user_jurisdiction):
        self.user_id = user_id
        self.user_name = user_name
        self.user_password = user_password
        self.user_jurisdiction = user_jurisdiction
    
    def to_dict(self):
        return {
            'id': self.id,
            'user_id': self.user_id,
            'user_name': self.user_name,
            'user_password': self.user_password,
            'user_jurisdiction': self.user_jurisdiction
        }